import Vue from 'vue'
import VueRouter from 'vue-router'

import MainPage from '../components/MainPage.vue'
import CreateTable from '../components/CreateTable.vue'
import FillTable from '../components/FillTable.vue'
import Test from '../components/Test.vue'
import TableAdmin from "../components/TableAdmin.vue";
import DownTable from "../components/DownTable.vue";
import FillResult from '../components/FillResult.vue'

import UploadFile from '../components/UploadFile.vue'

// import { Table } from 'element-ui';

Vue.use(VueRouter)

export default new VueRouter({
    mode: 'history', // 开启HTML5的history模式，可以让地址栏的url长得跟正常页面跳转的url一样。（不过还需要后端配合，讲Koa的时候会说）
    base: __dirname,
    routes: [
        {
            path: '/',  // 默认首页打开是登录页
            component: MainPage
        },
        {
            path: '/createtable',
            component: CreateTable
        },
        {
            path: '/table/:tableId',
            component: FillTable
        },
        {
            path: '/table/:tableId/fillresult',
            component: FillResult
        },
        {
            path: '/table/:tableId/admin',
            component: TableAdmin
        },
        {
            path: '/table/:tableId/admin/down',
            component: DownTable
        },
        {
            path: '/test',
            component: Test
        },
        {
            path: '/upload',
            component: UploadFile
        },
        {
            path: '*',
            redirect: '/' // 输入其他不存在的地址自动跳回首页
        }
    ]
})